/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jtmcraft.game.units.states;

/**
 *
 * @author tom
 */
public class MoveHelper {
    static double radian( double x, double y )
    {
        if( x == 0 && y == 0 ) return 0;
        if( x == 0 )
        {
            if( y > 0 ) return Math.PI / 2;
            return 1.5 * Math.PI;
        }

        double result = Math.atan( y / x );
        if( x > 0 && y < 0 ) result += 2 * Math.PI;
        if( x < 0 ) result += Math.PI;

        return result;
    }
}
